<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
	<meta charset="utf-8"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=500" />
	<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, multiple, pins, pin, sticky, cascade" />
	<meta name="author"	content="Jan Paepke (www.janpaepke.de)" />
	<title>Cascading Pins - Examples - ScrollMagic</title>

	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../assets/css/normalize.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/style.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/examples.css" type="text/css">
	<link rel="shortcut icon" href="../../assets/img/favicon.ico" type="image/x-icon">

	<script type="text/javascript" src="../../assets/js/lib/jquery.min.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/highlight.pack.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/modernizr.custom.min.js"></script>
	<script type="text/javascript" src="../../assets/js/examples.js"></script>
	
	<script type="text/javascript" src="../../scrollmagic/uncompressed/ScrollMagic.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/debug.addIndicators.js"></script>
</head>
<body>
	<ul id="menu"></ul>
	<div id="content-wrapper">
		<div id="example-wrapper">
			<div class="scrollContent">
				<section id="titlechart">
					<div id="description">
						<h1>Cascading Pins</h1>
						<h2>On-Again, Off-Again.</h2>
						<p>
							Sometimes you might wish to pin and unpin the same element multiple times. To achieve this simply add multiple scenes with the same pin target.
						</p>
						<p>
							It is important to make sure though, that the scenes don't overlap, so they don't <i>"argue"</i> about who gets to control the pinned element.
						</p>
						<a href="#" class="viewsource">view source</a>
					</div>
				</section>
				<section class="demo">
					<div class="spacer s1"></div>
					<div id="trigger" class="spacer s1"></div>
					<div class="spacer s0"></div>
					<div id="pin" class="box1 red">
						<p>Unpinned.</p>
						<a href="#" class="viewsource">view source</a>
					</div>
					<div class="spacer s2"></div>
					<script>
						$(function () { // wait for document ready
							// init controller
							var controller = new ScrollMagic.Controller();

							// show pin state
							function updateBox (e) {
								if (e.type == "enter") {
									$("#pin p").text("Pinned.");
								} else {
									$("#pin p").text("Unpinned.");
								}
							}

							// build scenes
							new ScrollMagic.Scene({triggerElement: "#trigger", duration: 150})
								.setPin("#pin")
								.setClassToggle("#pin", "green")
								.on("enter leave", updateBox)
								.addIndicators() // add indicators (requires plugin)
								.addTo(controller);

							new ScrollMagic.Scene({triggerElement: "#trigger", duration: 150, offset: 300})
								.setPin("#pin")
								.setClassToggle("#pin", "green")
								.on("enter leave", updateBox)
								.addIndicators() // add indicators (requires plugin)
								.addTo(controller);

							new ScrollMagic.Scene({triggerElement: "#trigger", duration: 150, offset: 600})
								.setPin("#pin")
								.setClassToggle("#pin", "green")
								.on("enter leave", updateBox)
								.addIndicators() // add indicators (requires plugin)
								.addTo(controller);
						});
					</script>
				</section>
				</section>			
				<div class="spacer s_viewport"></div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="../../assets/js/tracking.js"></script>
</body>
</html>
